#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int a = 10000, b = 30000, k;
	scanf("%d", &k);
	int x, y, z, pd=0;
	for (; a <= b; a++) {
		x = a / 100;
		y = (a % 10000) / 10;
		z = a % 1000;
		if (x % k == 0 && y % k == 0 && z % k == 0) {
			printf("%d\n", a);
			pd++;
		}
	}
	if (pd == 0) {
		printf("No");
	}
	return 0;
}//